package com.game.server;

import java.util.HashMap;

import org.jdom2.Element;

public class ServerConfig {
	
	private String name;
	
	private short port;
	
	public short getPort() {
		return port;
	}
	
	private String configUrl;
	
	public String getConfigUrl() {
		return configUrl;
	}

	public String getName() {
		return name;
	 }
	
	public String getClassName() {
		return className;
	}

	private String className;
	
	private HashMap<String,Object> parameters;
	
	public HashMap<String,Object> getParameters(){
		return parameters;
	}

		
	public ServerConfig(Element ele)
	{
		name = ele.getChild("Name").getText();
		port = new Short(ele.getChild("Port").getText());
		configUrl = ele.getChild("ConfigUrl").getText();
		className = ele.getAttributeValue("ClassName");
		parameters = new HashMap<String,Object>();
		Element eParameters = ele.getChild("Parameters");
		if(eParameters != null)
		{
			for(Element child:eParameters.getChildren())
			{
			   String name = child.getAttribute("name").getValue();
			   Object value = child.getText();
			   parameters.put(name, value);
			}
		}
	}
}   
